#include "StdAfx.h"
#include "AccountMonitor.h"
#include "CtpTraderSpi.h"

CAccountMonitor::CAccountMonitor(int type, 
								 const std::string& companay,
								 const std::string& name,
								 const std::string& pwd,
								 const std::string& srv,
								 int port ) :_company(companay)
							, _name(name)
							, _pwd(pwd)
							, _srv(srv)
							, _port(port)
{
	if ( type == CAccountMonitor::ACCOUNT_CTP ){
		ctpTraderApi = CThostFtdcTraderApi::CreateFtdcTraderApi();
		ctpTraderSpi = new CtpTraderSpi(  ctpTraderApi,"brokerID", "name", "pwd", "instrument" );
		ctpTraderApi->RegisterFront("tcp://172.16.22.193:41205");
		ctpTraderApi->RegisterSpi( ctpTraderSpi );
		ctpTraderApi->SubscribePrivateTopic( THOST_TERT_QUICK );


		ctpTraderApi->Init();
	}
}

CAccountMonitor::~CAccountMonitor(void)
{
}
